package com.sanyang.pda.ui.manualdelivery;

import android.os.Bundle;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.fragment.app.Fragment;
import androidx.viewpager.widget.ViewPager;

import com.alibaba.android.arouter.facade.annotation.Route;
import com.ogaclejapan.smarttablayout.SmartTabLayout;
import com.sanyang.pda.adapter.MyTitleViewPagerAdapter;
import com.sanyang.pda.utils.StringConfig;
import com.wangshen.base.app.AppActivityKey;
import com.wangshen.base.ui.mvp.base.ui.BaseActivity;
import com.wangshen.projectbase.R;

import java.util.ArrayList;

import butterknife.BindView;
import butterknife.OnClick;

@Route(path = AppActivityKey.MANUALDELIVERYDETAILACTIVITY)
public class ManualDeliveryDetailActivity extends BaseActivity {

    @BindView(R.id.iv_back)
    ImageView ivBack;
    @BindView(R.id.tv_title)
    TextView tvTitle;
    @BindView(R.id.tv1)
    TextView tv1;
    @BindView(R.id.title)
    FrameLayout title;
    @BindView(R.id.smart)
    SmartTabLayout smart;
    @BindView(R.id.vp_content)
    ViewPager vpContent;
    private ArrayList<String> list_title;
    private ArrayList<Fragment> list_fragment;
    private MyTitleViewPagerAdapter mPagerAdapter;

    @Override
    public int getView() {
        return R.layout.activity_manual_delivery_detail;
    }

    @Override
    public void initView() {
        Bundle bundle=getIntent().getExtras();
        String entryNo=bundle.getString(StringConfig.ENTRYNO);
        tv1.setText(entryNo);
        list_title = new ArrayList<>();
        list_fragment = new ArrayList<>();
        list_title.add("上架");
        list_title.add("统计");
        //list_title.add("明细");
        //初始化各fragment,并加入列表
        PutOnFragment putOnFragment = new PutOnFragment(entryNo);
        DeliveryStatisticsFragment deliveryStatisticsFragment = new DeliveryStatisticsFragment(entryNo);
        DeliveryDetailFragment deliveryDetailFragment = new DeliveryDetailFragment(entryNo);
        list_fragment.add(putOnFragment);
        list_fragment.add(deliveryStatisticsFragment);
       // list_fragment.add(deliveryDetailFragment);
        mPagerAdapter = new MyTitleViewPagerAdapter(getSupportFragmentManager(),list_fragment,list_title);
        vpContent.setAdapter(mPagerAdapter);
        vpContent.setOffscreenPageLimit(2);
        smart.setViewPager(vpContent);

    }

    @Override
    public void initLinsenterner() {

    }

    @Override
    public void getData() {

    }

    @OnClick(R.id.iv_back)
    public void onViewClicked() {
        finish();
    }
}
